using UnityEngine;
using System.Collections;

public class PlayerAttackState : State<PlayerControl>
{
    #region Singleton

    private static PlayerAttackState instance = new PlayerAttackState();
    public static PlayerAttackState Instance { get { return instance; } }
    private PlayerAttackState() { }

    #endregion

    #region State

    public override void OnEnterState(PlayerControl behaviour)
    {
        //behaviour.gameObject.renderer.material.color = Color.red;
        // Atacar
        behaviour.Attack();
    }

    public override void OnUpdateState(PlayerControl behaviour)
    {
        // Idle
        behaviour.State = PlayerIdleState.Instance;
    }

    public override void OnFixedUpdateState(PlayerControl behaviour)
    {
    }

    public override void OnExitState(PlayerControl behaviour)
    {
        behaviour.weapon.transform.rotation = Quaternion.identity;
        behaviour.weapon.GetComponent<MeleeWeapon>().AttackEnd();
    }

    public override void OnCollisionState(PlayerControl behaviour, Collision other)
    {
    }

    public override void OnTriggerState(PlayerControl behaviour, Collider other)
    {
    }

    #endregion
}
